﻿@using SolidCP.WebDav.Core.Extensions
@using SolidCP.WebDavPortal.Models.Account.Enums
@using SolidCP.WebDavPortal.Resources
@using SolidCP.WebDavPortal.UI.Routes
@model SolidCP.WebDavPortal.Models.Account.PasswordResetPincodeSendOptionsModel

@{
    var indexOf = Model.Email.IndexOf('@');

    var maskedEmail = string.Empty;
    for (int i = 0; i < indexOf - 1; i++)
    {
        maskedEmail += '*';
    }

    maskedEmail += Model.Email.Substring(indexOf - 1);

    var maskedPhone = string.Empty;
    for (int i = 0; i < Model.MobileNumber.Count() - 5; i++)
    {
        maskedPhone += '*';
    }

    maskedPhone += Model.MobileNumber.Tail(4);
}


<div class="container row">
    @using (Html.BeginRouteForm(AccountRouteNames.PasswordResetPincodeSendOptions, FormMethod.Post, new { @class = "user-password-pincode-send-options bs-val-styles col-lg-10 col-lg-offset-3", id = "user-password-reset" }))
    {
        <div class="form-group">
            <h3>@UI.PasswordReset</h3>
        </div>
        <div class="form-group">
            <div class="input-group">
                <label class="control-label">@UI.SendPincodeTo </label>
            </div>
            <div class="radio">
                <label for="mobile-radio">
                    @Html.RadioButtonFor(x => x.Method, PincodeSendMethod.Mobile, new { id = "mobile-radio" })
                    @UI.MobilePhone: @maskedPhone
                </label>
            </div>

            <div class="radio">
                <label for="email-radio">
                    @Html.RadioButtonFor(x => x.Method, PincodeSendMethod.Email, new { id = "email-radio" })
                    @UI.Email: @maskedEmail
                </label>
            </div>

        </div>
        <button type="submit" class="btn btn-default">@UI.Send</button>
    }
</div>
